from flask import Flask

import settings

from apps.users import user_dp
from apps.Llama2 import llama2_dp
from apps.Llama3 import llama3_dp
from apps.LLM import llm_dp
from apps.ResearchGuide import researchGuide_dp


# 创建数据库对象

def create_app():
    flask_app = Flask(__name__, template_folder='templates', static_folder='static', static_url_path='/static')
    # 加载配置
    flask_app.config.from_object(settings.DevelopmentConfig)
    # 注册蓝图
    flask_app.register_blueprint(user_dp, url_prefix="/user")
    flask_app.register_blueprint(llama2_dp, url_prefix="/llama2")
    flask_app.register_blueprint(llama3_dp, url_prefix="/llama3")
    flask_app.register_blueprint(llm_dp, url_prefix="/llm")
    flask_app.register_blueprint(researchGuide_dp, url_prefix="/researchguide")

    # 配置第三方扩展
    return flask_app
